﻿using B.S.Data.MES.API.Applications.AssignattributesOneApplications;
using B.S.Data.MES.API.Dto.DtoAssignattributes;
using B.S.Domain.Process.AssignattributesOneModel;
using B.S.Requst;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Data.MES.API.Controllers
{
    /// <summary>
    /// 工艺维护（属性一/二）
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class AssignattributessController : ControllerBase
    {
        IMediator mediator;

        public AssignattributessController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 属性一显示左侧所有属性
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIPageing<List<DtoAssignattributesOne>>> ShowAssignattributesOne([FromQuery]ShowAssignattributesOneCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 属性一显示右侧所有属性
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public async Task<APIPageing<List<DtoAssignattributesOne>>> ShowAssignattributesOneType([FromQuery] ShowAssignattributesOnesssssCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 修改左边换成右边
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIRequst<int>> UpdateAssignattributesOne([FromBody]UpdateAssignattributesOneCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 修改右边换成左边
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIRequst<int>> UpdateAssignattributeYouAsync(UpdateAssignattributesssOneCommand request)
        {
            return await mediator.Send(request);
        }
        /// <summary>
        /// 属性一添加属性
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIRequst<int>> AddAssignattributesOne([FromBody]AddAssignattributesOneCommand request)
        {
         return await mediator.Send(request);   
        }
        /// <summary>
        /// 修改值
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIRequst<int>> UpdateAssignattributeFangfaOne([FromBody]UpdateAssignattributeFangfaOneCommand request)
        {
            return await mediator.Send(request);
        }

    }
}
